C_UNITS := world
ASM_UNITS := start

CLANG_FLAGS := --verbose $(OPTIMIZATION) -c -march=i386 --no-standard-libraries --target=i386-pc-linux-gnu-elf -I $(SOURCE)/include -fasm-blocks -fms-extensions
CLANG_C_MACROS := $(addprefix -D, $(C_MACROS))
NASM_FLAGS := -f elf32 -I $(SOURCE)/include
LLD_FLAGS := --verbose -m elf_i386
OBJECTS += $(addsuffix .c~, $(C_UNITS)) $(addsuffix .asm~, $(ASM_UNITS))
VPATH := $(_BUILD)
all: $(OBJECTS)
	$(LLD) $(LLD_FLAGS) -o $(BUILD)/$(MODULE)/$(SUBMODULE).EXE $(addprefix $(BUILD)/$(MODULE)/, $(OBJECTS)) $(BUILD)/Utility.obj
%.c~: %.c
	$(CLANG) $(CLANG_C_MACROS) $(CLANG_FLAGS) -o $(BUILD)/$(MODULE)/$@ $(SOURCE)/$(MODULE)/$(SUBMODULE)/$<
%.asm~: %.asm
	$(NASM) $(NASM_FLAGS) -o $(BUILD)/$(MODULE)/$@ $(SOURCE)/$(MODULE)/$(SUBMODULE)/$<